import binascii
import base64
from tongsuopy.crypto.ciphers import Cipher, algorithms, modes

# flag = "***"
# key = "***"

iv = b"0123456789ABCDEFFEDCBA9876543210"

c = Cipher(algorithms.SM4(key.encode("utf-8")), modes.CBC(binascii.unhexlify(iv)))
enc = c.encryptor()
cipher = enc.update(binascii.unhexlify(flag.encode().hex()))
cipher += enc.finalize()
print(base64.b64encode(cipher))
